From 70a729c4100ee0058f461718d6a261b5e47a21ea Mon Sep 17 00:00:00 2001
From: Morten Fangel <fangel@sevengoslings.net>
Date: Thu, 7 Jul 2011 15:03:22 +0200
Subject: [PATCH] Unable to autocomplete terms containing commas or quotes.

---
 modules/taxonomy/taxonomy.pages.inc |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc
index 3aed290..24e0a01 100644
--- a/modules/taxonomy/taxonomy.pages.inc
+++ b/modules/taxonomy/taxonomy.pages.inc
@@ -110,7 +110,7 @@ function taxonomy_autocomplete($field_name, $tags_typed = '') {
       ->execute()
       ->fetchAllKeyed();
 
-    $prefix = count($tags_typed) ? implode(', ', $tags_typed) . ', ' : '';
+    $prefix = count($tags_typed) ? drupal_implode_tags($tags_typed) . ', ' : '';
 
     $term_matches = array();
     foreach ($tags_return as $tid => $name) {
@@ -119,9 +119,8 @@ function taxonomy_autocomplete($field_name, $tags_typed = '') {
       if (strpos($name, ',') !== FALSE || strpos($name, '"') !== FALSE) {
         $n = '"' . str_replace('"', '""', $name) . '"';
       }
-      else {
-        $term_matches[$prefix . $n] = check_plain($name);
-      }
+      // Add term name to list of matches.
+      $term_matches[$prefix . $n] = check_plain($name);
     }
   }
 
-- 
1.7.4.1

